package com.deng.eventflow.core;

import java.util.Queue;

public class Doubler extends SynchronousProcessor {

    public Doubler() {
        super(1, 1);
    }

    @Override
    protected boolean compute(Object[] inputs, Queue<Object[]> outputs) {
        outputs.add(new Object[] {2 * ((Number) inputs[0]).intValue()});
        return true;
    }

    @Override
    public Processor duplicate(boolean with_state) {
        return new Doubler();
    }

    @Override
    public Doubler readState(Object o) {
        return new Doubler();
    }

}
